<%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2024/6/7
  Time: 18:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>work1.4</title>
</head>
<body>
<%
    String user = (String) session.getAttribute("user");
    if (user == null)
        user = "";
%>
    <h1>Guess the number game</h1>
    <h2>Welcome <%=user%></h2>

    <a href="<%=response.encodeURL("Login")%>">返回登录页</a><br><br>
    <form action="<%=response.encodeURL("Guess")%>" method="get">
        <label for="number">请输入猜测的数字：</label>
        <input type="text" id="number" name="num"/>
        <button type="submit">确定</button>
    </form>

<%
    String result = (String) request.getAttribute("result");
    if (result != null) {
%>
        <p><%=result%></p>
<%
    }
%>
</body>
</html>
